﻿using UnityEngine;
using System.Collections;

public class stayOnScreen : MonoBehaviour {

    // Use this for initialization
	void Start () 
	{
	}
	
	// Update is called once per frame
	void Update ()
	{
        if (transform.position.x > WithinBounds.Bounds.maxX)
        {
            transform.position = new Vector3(WithinBounds.Bounds.minX, transform.position.y, 0); 
        }
        else if (transform.position.x < WithinBounds.Bounds.minX)
        {
            transform.position = new Vector3(WithinBounds.Bounds.maxX, transform.position.y, 0); 
        }
	}
}
